﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TinyCms.Core.Repositories
{
    public interface IRepositoryContext:IUnitOfWork, IDisposable
    {
        /// <summary>
        /// 仓储上下文唯一的id标识
        /// </summary>
        Guid ID { get; }
        /// <summary>
        /// 向仓储中注入新的对象
        /// 提交时将持久化到数据库
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        void RegisterNew<T>(T obj)
            where T : EntityBase;
        
        /// <summary>
        /// 将仓储中的对象置于已修改状态
        /// 提交时将在数据库中更新
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        void RegisterModified<T>(T obj)
            where T : EntityBase;
        
        /// <summary>
        /// 将仓储中的对象置于已删除状态
        /// 提交时将从数据库中删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="obj"></param>
        void RegisterDeleted<T>(T obj)
            where T : EntityBase;
    }
}
